package com.fosss.band.controller;

import com.fosss.band.entity.Comment;
import com.fosss.band.service.CommentService;
import com.fosss.band.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author: fosss
 * Date: 2024/1/7
 * Time: 11:21
 * Description:
 */
@Api(tags = "评论相关接口")
@Slf4j
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Resource
    private CommentService commentService;

    @ApiOperation("获取专辑评论")
    @GetMapping("/selectAll/{albumId}/{order}")
    public Result selectAll(@PathVariable("albumId") Integer albumId, @PathVariable("order") String order) {
        log.info("获取专辑评论");
        return commentService.selectAll(albumId, order);
    }

    @ApiOperation("添加评论")
    @PostMapping("/add")
    public Result add(@RequestBody Comment comment) {
        log.info("添加评论：{}", comment);
        return commentService.add(comment);
    }
}















